package com.hs.permission.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hs.permission.pojo.SsModule;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Bai
 * @since 2022-07-27
 */
public interface SsModuleMapper extends BaseMapper<SsModule> {

    @Select("SELECT \n" +
            "   DISTINCT m.*\n" +
            "FROM ss_module m\n" +
            "  INNER JOIN pe_role_module rm ON m.module_id=rm.module_id\n" +
            "  INNER JOIN admin ru ON ru.id=rm.role_id\n" +
            "WHERE 1=1\n" +
            "  AND ru.id=#{userId}")
    List<SsModule> findModuleByUserId(Integer userId);

}
